package com.flower.controller.buyer;

import com.flower.annotation.Log;
import com.flower.domain.entity.Buyer;
import com.flower.service.BuyerService;
import com.flower.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 购买者端个人信息
 */
@RestController
@RequestMapping("/buyer/account")
public class BuyerController {

    @Autowired
    private BuyerService buyerService;

    /**
     * 获取个人信息
     * @return
     */
    @GetMapping("/info")
    public AjaxResult getUserInfo() {
        Buyer buyer = buyerService.getUserInfo();
        return AjaxResult.success(buyer);
    }

    /**
     * 修改个人信息
     * @param buyer
     * @return
     */
    @Log(name = "修改购买者个人信息")
    @PutMapping("/update")
    public AjaxResult updateUserInfo(@RequestBody Buyer buyer) {
        buyerService.updateUserInfo(buyer);
        return AjaxResult.success();
    }
} 